changed save order functon