Must handle named groups and assertions as well. Added expand method.