refactoring binary