Refactor and some redesign.