Annotated this code thanks to my guy Tictac