cleaning up model code a bit