Untangling the mystery of why shoelaces come untied