Standalone algorithms & structs to help build Mirror.