Rewrote rendering routines, various changes