Moving functions from datahandler to diagnosis, renaming files, fixing imports.