numerical stuff added; needs testing