Add Mono Support

This wraps up the changes to make the code compatible with mono.