Far more correct than the previous commit