adds tests, resolves #1 #3