debugging and code cleanup.