Added canvas saving and restoring