Cleanup g_turret.c and add sanity checks