intelligent selection of direction depending on cell