Main model code complete