Changed code to PSR2 coding standard