Should now compile and run correctly. Untested on Windows