Task handling in queue