Merge pull request #1 from pvanheus/master

Change to use functions, add test code