refactoring, split code to multiple files