updated to use the APIs