refactor according to orientation