added distribution function to queue class