refactored the project to consolidate code