Optimizes table shuffle code

Should reduce startup time.