added sqrt testing to speed up process