added validate_order function and some consts