Changed throws to new Error()