Improved bot follwing code.