added validation, some tests