refactor move boolean to variable