For the second you could also check on the code instead of type. But I guess in the end this is not that important.