Code cleanup, support more types.