printing got better; global loss function removed