added validation for same origin and destination