refactor for underlying library