This looks suspiciously similar to code from CoFHCore