rework so it builds with modern toolchains