improved render algorithm

removed some copy-paste from the calculate laevel algo
added commentaries :)
now the loading from a file actually works :)