Improving the code by refactoring. Introduced function templates for handling serialization and deserialization of json data. Improving error handling mechanism.