Better way of generating paths