Removed useless gradW and transformed h into a global constant