Added hooks to index_add
Added rudimentary logging, should maybe consider converting the rest