make it read tables correctly and added table interpolation