refactor lib dir