Support fromCode, fromEmpty