Add logic; update tests