old pseudocode for control

also on google drive/docs