rebuilds and removes logs