Refactoring and Adding Json parsing