Fix: Refactored and repaired chat, logout, file upload