Fixed some bugs and made a functional Linux build.