attempt2 at loop fix