nightly proc psuedo code