refactored code to "modularize" each thing in the app folder