Added ModelState to model ModelState, rewrote respective functions.