move var to more logical place
move tiletype logic into tiletype