changed code for schedule runs