move updateStoryHandler function out of inline