still working on figuring out why the loop is repeating itself