Initial addition of STGT support (works mostly).