Yes, this code is very difficult to understand. Especially if you don't know how tensor manipulation works in modern physics.