Replaced std::abs with #include <cmath>