This is the annoying bit, where we've got to pass in the 'self' Pid - is there a nicer way to add state to something that's user-implemented?