Adds swap files
Adds state factory and checks send_data is called inside receive data method
Parse payload and opperate on type variable
Sends back error response if malformed
Send error if type is not recognised