Fixed rayleigh test and testing function

Hope everything works now