Added helper method for direction conversion.