refactor 8 cases