Some new functionality and correct some errors.