reformated some code to adjust to PSR-1