Copied everything over from mono