Refactored with new class for graphics