Added some logging and internal variable name cleanup.