Added tests and changed some things in model