Added more helper functions and small tests