added horizontal and vertical add functions