GH54 - fix bug with creating file in project throwing exception and
tidied up the code