Some naming changes and code re-factor.