Refactor graphics methods to a new class