Update to be fully compatible with modern API