Removes logs and minor optmz