Refactoring code

TODO: The stream path returned is hard coded. This should be changed
into a configurable variable.