major refactor of module structure