Implemented MessagePump class