working loops 1 and 2 still 3 but if-else still not working