Improvements to autoconfigure. Not completed yet.