Bit of locking and logging cleanup