Added coding guidlines, improved code readability and fixed small bugs

Linting branch is already merged into this!