Simplify the code and make it build on Linux.