Direction logic and handling (first try)