speeding up tests, using -w option.
minor refactoring.
Added UI tests.