refactor lib directory for better loading