updated for newest code