Refactored get_value