Implemented initial serializer

Could somebody review this and give some feedback, or merge it into master