Big update for maximum compatibility with SF2.4+