Modularized bot functions (mostly).
Cleaned up main script a bit