major refactoring, pluggable arch