Clean up DB stuff, prepare tags