Move check of container name into event handler.