added new functions and tests