Starting bidirectional communications

stats from slave back to master
also breaking out slave stuff into its own file.