Fix for last commit, moved some assigns so they are available where referred to