Fixed bad use of std::abs.
Thanks to Daniele Panozzo for pointing me at this.
Fixed a couple of compiler warnings.