Integrate jade and fix some minor bugs