Inbox outbox logic added