Refactor check for uncommitted changes into method
Move global var fetches to correct tasks