Improve user model and add more tests