Based on the fact that we will have to add other geometries as well, this is a good point. However I would suggest creating a function for each geometry then. It is not very useful to put everything in a separate function at this moment because we would just call them once. They are not really subfunctions, you just have to create separate matrices based on each other.