Tidying up unused variables and double declaration