Add pseudocode to body of RS calculation function for later adaption.