Fixed some more issues with Linux, and more work on the plotting algorithm