Nearly done refactoring stuffs.