Tidy up the helper and add more tests