core/models: tidy up code a bit.