working to a certain point. no longer infinite looping.