multi os support

Do not merge, work in progress.