Added unit tests, includes PEP8 fixes