removed redundant string and refactored code