finish order function