Made a little more robust