Refactor bit by bit.