PSR-2 and docblock strandard

A lot of lines in those two commits, but only cosmetics: Indentation, rearrange code and fix/add docblocks.