algorithm works, but results not displaying