Mostly style / error message fixes. Also, more type-safe declarations!