Misc tweaks
Replaced C5 dependency with some code from Mono's BCL implementation