Added more unit tests.
Start returning some warnings if something goes wrong.