Updated the source a bit with some formatting. My numerous extern(C) statements were a bit ugly so I wrapped it all up into a block.