Update views with cleaner source code

I updated the views error and index with cleaner source code and also made it more structured to allow better reading of the source code :)

Pull request must not be accepted, I just did it for fun ;)