Some bot refactoring