Generic Queue Implementation