adding handleQueue method