Add moveDirection function