Start refactoring to merge common functioanlity, and only separate out
the OS specific parts.