Initial revamps, preparations to move to ruby db