Implementation of review comments - some more refactoring.
Had left some sysouts. Removed them.