Refactored the code with respect to name