webchat: cleanup code