rename toBytes methods
implement serialize method