added validation and final changes