new version of the setdirection