some logic cleanup, added documentation, controlled logging on unknown products