touched up stack, implemented queue