Tidy up code

Delegate path to file, to simplfy some method calls
Reorder the logic for :clean to check it exisits first
Simplfy publishing logic