added working gradient stuff