#9 make library functions more generic