Rename main module
Refactor for easier testing