Fixed bug #4. Refactored tests so it would be easy to combine patch files for each test scenario.