Support nested bindings and nested expressions

Also add a few ignored failing tests
Transfer recent bug fixes from implement interface to record generation

Fix #415.
Merge pull request #421 from dungpa/record-generation

Support nested bindings and nested expressions in record generation