moved graphics code into a simple class.