added queue and modified stack