Clean up example program
Add loss functions