Fix tag changing. Delete unused functions.