Code cleanup and PSR