Adding proper gradient