Code style fixes
Better way of determining basepath in main config file.
Don't remove component config after initialisation, and expose it to developers

I can't really see why this was ever happening. I didn't really want to
hack up core code, but the alternative was probably a lot of messy
hacks.

I've also added braces around some blocks to make the code easier to
debug.