making progress
array indices working for apply_deriv