cleaning up gun code