Made the code more pythonic
added some stubs for docstrings