look in notes for pseudo code methods