reorganized linux implementation. No code change just moving functions around