Removed dead code and unused arguments (+ fixed a few typos)

Removed two undefined variables