Changed logic for direction calc