update things a little to follow idioms and add an assertion