fixed and expanded upon with ref