fix some PSR2 issues, cleanup code