Clean up frame insertion; for some reason this doesn't crash as much