Setting up some initial unit tests.

Already found a bug.
Fixing painting module.
Improving Unit test.