ugly beagle code