Added basics of serialization. Fixed building problems