Also makes a few general improvements to the build process and removes some dead code.
The option must be enabled from the command line