Created a separate class for serialization