modified for new api