WCM-58 Generate markup and simplify generated JS