Added FromJSON and ToJSON instances to machines. Minor cleaning made.