rewrite model constructor to use variable maps.