Add type ascription and fix two nasty bugs
Add records