the index and type should also be constructor arguments rather than being set by setters