Pedantically tidy up white space and standardize the encoding
Make private function protected so the class can be extended
Use currently redundant $next param