chat implemented, working on optimization