multiple improvements; fixed wrapping of tiles