Made it more robust