refactoring
organized code; moved commonalities between different files to a separate file