Refactor blocks, programs and inverses