Refactor and test all.