Refactor top-level avalon into a module