Major code cleanup to align with pep8 conventions. Switched cache loading to with statements, safer and better. No more open file descriptors floating around