still working on commenting and refactoring