finished refactoring LossFunctions