Push the (still messy) logic into the model