refactor library methods so they test better