refactor open story link function