(Hopefully) final version of the slave program
At the moment working master but forgetting the data for output