Updated to work with new API