Refactored the code by removing unnecessary Method call