convert to knots, some code optimization