refactor slightly, add another test