I changed this here, because using the class factory is a bit cleaner.