added tile script and made compatible with python 3