misc improvements. Removes files at the end. Fixed DB