Use macros instead of direct access to object fields

- Add new macros
- Rewrite some functions that use direct access
- Fix typo in TODO file