Nest boxes need to be at least 18 inches above the floor of your coop, and lower than the roosts. The boxes also need to be fairly dark inside, maybe covered by a curtain. If the hens can't see the eggs they are not tempted to peck them. Gathering the eggs often might also help.