this crashes if name is null. you should consider throwing IllegalArgumentException if the constructor is called with a null argument.