Remove a legacy code and Clean up.
Removed the duplicate code.