new library routines, compile but otherwise untested