Cleaning up all the files for pep8, pylint and pyflakes. Made tests more intelligent