Change replace to insert for the zz_battles table
Move some { } around