Added support for dict, to make the work with the database a bit more
optimized
After small refactoring, have not tested it yet, need to refactor the
code to be shorter and more efficient