working on broken loop code