removed unnecessary gradient() function