add slower, but more flexible method; needs to be optimized