Fixed some compiler warnings

Mosty unused variables (detected by GCC 4.9.1 with extra warnings turned on). 

Also has your newest changes.