cleaned helper and added a test