Get iterative refract() function working