updated to use cg-newton instead of trust-region newton