Deal reached in gun debate