Tidying up of code, and initial stages of code for Publication handling