example cleanup and minor code cleanup