jaggery 2 reinvented with javascript