some more code commenting and cleanup