updated main to include connectionerror and reorganized modules