Cleanup of mailboxes code