I think all this could be DRYed out with an after block and some creativity too.