Refactor terrain