refactor architecture