Added a test and refactored testhelper.