added findOrientation bounds check