Refactoring and cleanup

- Fixed some problems in ProgVars.
- Updated several examples.
- Work-in-progress, won't compile.