simplify direction conversion logic