Moved code creation to internal API