Removed DOS newlines and changed scoping on new_th