Some re-organization as per PEPr suggestions
Fix warnings and errors reported by PHP_CodeSniffer