Adding commandline support and fixed json parsing