defined methods as named functions rather than a list of vars