Added more pseudocode to make it easier to finish