Added sampling frequency but just showing it for now.
Moved compressing and file writing code out of the service