updated loss functions and started adding a few convenience functions