Refactory Graph controller