removing many unused variables and adding -Wall to the compiler options