add message passing logic between front and background