Add queue and get tasks tests, refactor