Modified to add a queue for input/output messages