Refactors module structure