Reduced code and made code more readable