Refactor application into smaller modules