Clean up lock code.