additional code cleanup, and documentation