remove unused variables and debugging code