refactored __set to be less complex