Implement value setter
NOTE: this code is bad and needs to be refactored