extract checkAllDirections method