I’m pretty sure @Volts has the correct order for the Plex Dance.
From the “Tips, Tricks, & How-Tos” section, the article The Plex Dance has the only order that works properly every time. The order suggested by @trumpy81 may work, but I have my doubts. 
As an aside, on the few occasions I’ve had to use it, I skip the optimize database part. It’s never made a difference in the results, and the database is optimized during maintenance periods anyways.