Continued refactoring for openpprn/opn#7. Fixed tests