Version dealing with infinite types. Almost finished.