function definition updates to reflect pseudocode