logic cleanups, commenting