Redoing the rect code to use a type dispatch table