Implemented addToQueue functionality