added graphics.c, thinking about memory race conditions and how to stop them