Added gradient clipping