Wrap the rest of the megahal functionality added in the previous commit