first attempt of making a smart queue