much commenting and cleanup