Now writes to c and h file instead of stdout. Fixed bug in tile generation.