Added test case and organized code and comments
Flake8