added tests
Reordered files + fixed small issues in the main code.
Merge pull request #1 from Tommalla/tests

Tests