Generalise addRaster/Vector and simplify code