#321 Implemented more tests, added more checks and documented remaining work with TODOs.