Overhauling build structure. Other fixes.