updating to be more robust