refactor (split code into modules)