refactored and added Json deserialization support