fix typo in variable name, restructure