Refactor some preview rendering code
Cache rendered tiles