Added code to better deal with generation of ore