Fix undefined classes used in code
Fix undefined classes in comments
Make code PSR-1 and PSR-2 compliant + some minor changes