Updated the test and example code