Updated to match newest code