phpcs fixes, minor refactoring