Moved draw code from main.c into output.c