Create database only if needed
Code cleanup