Fixed #2. Added some tests.