Fix formatting issues and script/result refs