Cleaned up code in lock! method