Reformatted code to match PSR-1/PSR-2
Fixed @param and @return for better static analysis (PHPStorm)
Applied various fixes