Organize and add tests

Put things in packages, so that test writing is possible.

Write tests for simple situations so far.

Make the tests pass.