Remove unused variables and modify printf formats to remove warnings