refactored files to be easier to understand