added validation and testing