updated for latest code