Adding cuckoo test code from @bschmoker