Some refactoring is done.