Modularized build structure somewhat

Cleaned up as well.