cleaned up interpolation code