Remove deprecated apply() usage