Varius fixes, code tidy, disable unused variables