Tidy up and ensure ccd directorty created correctly