Got rid of a lot of code repetition in the Linux specific code and removed some friend declarations in favor of new public methods.