Added auto per-chip frequency tuning, added JSON API, some code refactoring...