finfished-pseudocode+ref