debugged issue #2, minor cleanup.