Remove duplicate variable accessors.
Add more error checking.