change .with to .when due to reserved word status