Small refactor; update tests