Initial addition of STGT support (works partly).