refactored architecture