Reworked serialization system to be more flexible and easier to use