added a more robust interface