Refactored version. using attribute for it