refactoring code into separate files