before refactor: collapse state