Ported over a few updates from angular-embryo