Improve doc strings and merge in from the previous prototype