Generalise flag() function. Make models a bit more useful.