create _ids collection
added error code
added functions to add to front