refactored queue functions to use vector