sorting by orientation