Refactor first three solutions.