tile generation algorithm cleanup, plus some variables renaming