Split off models from controller

Patch is from Brady/tippenein... using a squashed commit to avoid
messy Git history.