Style and documentation improvements

+ Adding docstrings to functions
+ Complying with style guide