entity references are now usable, code cleaned