Logic fixes in Lexicon class and data-handling fixes in JsonStorage.
Added tests.