modified file using revisions/fixes provided by Rowland