further refactory on graphics