refactor queue class