Refactor pseudocode with prototype creationg