Code refactoring + bot special handling