Sorted out the preprocessor conditionals that had turned into a maze.