added safe rebuild from scratch script