added better waits and logging