Refectored Code.
Further Refactoring