refactor some architecture code