Changed API to allow different loss functions.
Changed CMake minimum required version