Tying knots