modify queue and add atomic