Changes and additions for memory model

- Replaces type tags with actual types, I think it's clearer
- Filled in TODO sections
- Added description for resources
- Added example for by-ref returning
Any idea why boolean is capitalised here, yet integer isn't?