Refactoring(Delete the unnecessary logic)