added grad skip logic