I know it can be far more elegant and versatile but I will work on those changes after I am finished writing my thesis