Fixed most of the stuff. Update g for every layer whenever we learn a new function.

Fixed most of the stuff. Update g for every layer whenever we learn a
new function.