I don't think the code gets more beatiful because of this, but it seems like it does not crash anymore.