Converted story coffee script to plain javascript