ported from koorchik / hph-validator-livr