refactoring, terrain demo improvements