dynamic error matrix computation
minor cleanup