This seems a little dodgy. Shouldn't there be some existing best practice for doing this? Or if there isn't perhaps this should be in a shared file somewhere?