Fix some PEP8 and PyFlakes errors
Add Tests