Improved extension logic, added config system and tightened up the directory layout.