Added gradient checking!  Slow but it works.  Use command line arg to do gradient check.