added queue functions and test