Updated story.py for database