Refactor setDirection again