converted to a module and cleanup with linting