added validation and error messaging. added underscore library