Portability issues resolved

It now actually runs on my linux box, and should run on OSX too.