Added modular architecture. Refactored into core and optional modules