Update lib

Clean up the code