Tested all queue functions. TODO: comment all code