Some Code refactoring.