Cleaning up plugin and db handling