added queue and next features
fixed next bug