Moved from coffee to plain javascript