Added code to enterQueue and exitQueue