Finished serializeToJSON function
Updated relations functions