Move serializer to seperate class
Revert setType

Doesn't really belong to this PR