some refactoring in bot core