Added some more tests for views (only index for now)

Other stuff:
* Made some PEP8 corrections
* Made some refactoring of the code