Replace var keyword with type
Fix tiling bug