refactor and add a Queue example