Added more helper functions and test scripts