Adjusted connection handling

Bot now uses pooled connections
Reorganised structure.