Chunk based rendering

Chunks have been added, and now everything uses chunks, also a lot of cleanup and refactoring