[smotri] Modernize, make more robust and fix tests