rewrite so we can have testcoverage