Refactor some mutex locks/unlocks