added handling for empty beginning queue
added handling for empty beginning queue with offset of zero