changed code to take out gradiant