refactor gradient checking module
iron out some style issues
some more changes --