added some new util functions and tests