Code reformatted to abide PSR2 standard