refactor architeture