Refactoring and cleanup

- Updates in program variable function wrappers.
- Work-in-progress, won't compile.