Tidied up spatial interpolation code