Refactored, added dispose and graph feature