Code cleanup and variables renamed.