Deploy script refactor. Moved cleanup bits