working on gradient calcs