Added initial support for modular backend during compile time.
Refactor code.