refactored chat page