refactoring main lib to use utils