Optimize set and get methods.