Extracted lua script to separate files. Moved to the new tiles persisting scheme.