added graph and bug fixes