implemented changing obstacles
made corrections in condition