add setValue method
some simple optimizations