factored out chat box