Removing unused variables in template