Changed the order of inputs to be more consisten with the spatial
version.