Debugging + CIDs

CID generation should now work properly through querying database -
live, so will slow down with time and is not a great permanent solution.
Debug widget added. In the process, broke application icon(s) and other
resources, oops.