Added queue to the implementation

In hopes that it fixes the missing documents when inserting large
amounts of data into the database. Also added sort: path to the getter
function