Fixed to work with new API