wrote retrieveVal, which completes almost all of simpleVar