Fixed a typo in a variable name.
Removed const from temp so it works.
Fixed another typo.