Updated to fit new API