adding cython implementation
changing from hard coded loss function to calling external loss function