DRY: use nammed patterns and reerse funtion, even in js.