added function definition for getLastOrder