added add_val function
slight refactor