added user validation and insertion