refactored src to lib.