loops to fix first bug