Improved formatting and comments, added method to retrieve current lock