Refactor environment to its own repo