fix bugs and finalise communication