Fix scaffold

Fix return type of `term` in implementation. Also add scaffold for
`data` structure (since almost all modules are going to need it).