added some new functions and tests