gradient check code added and working