doing in a better way
refactoring - better implementation