Removed the BinaryFormatter because it's unsafe to use, so we're currently serializing and deserializing to json. Refactored the code for simplicity and readability.