project is now working but needs refactoring