More debugging infra

plus trace