Fixes #861
This raised the opportunity to structure the library more cleanly for each supported platform.