Updating psudocode + adding comments, not finish yet