Refactoring the module to start separating the layers of functionaity behind a kind of an API. This will mean we can add Windows support easily