Fixes and code cleanup for the tool shed's "Latest revision" queries.