Huge refactoring to achieve high quality standard.