Refactored everything into modules