Changes to make more rubust