Move declaration of variable 'rc' to the top of block