Moved identification of loopDirection enum to a separate function.