first version, without code generation