added server side validation and mongo database connectivity