Fixes some compiler warnings

* Removes dead code
* Removes unused variables