refactoring: split into files to allow extensions