implement a better lazy loading of internal variables

pull request to determine the best approach for this.