Added snow terrain and fixed flatten algorithm