a tidied version of the sparse tensor stuff, ready to throw at real data