Use ReflectionHelpers

Use the ReflectionHelpers methods rather than having #if code everywhere.

Shouldn't change any behaviour except the following commit: c99103b5e435a15fa24b0ea89f9bf4b2261f35a9
I believe this is correct now, please see the comments on the commit.