Tidying up some logic
Logging to help debug filename logic