added afterRead and beforeWrite callbacks