using some more functions. minor library refactorings.