Update code to match docs. Refs #2