queue conditionals to insert and remove elements