Code cleanup and PSR standard fixes