Refactor and improve code base.