added optional callback to setItem