starting point, modified from chat app