Added more psedocode