added dirty flag to models