Move most edit lock functionality to its own file