Realized createOrder function