Gl/use res id in ivs

Depends on #287.