model refactoring, and client-side validation