Refactor graphics classes