Refactored Some Code