Code cleaned up, a variable amount of bad data in the beginning can now be ignored for better graph results