add direction handling