allow for passing in of a prototype, removing assumption of where it exists
fixes #3
add unit tests
fixes #4