updated robot logic