update psudo code to include validation