Refactored the lockup instance code. Fixed all the tests