cleaned up R wrapper, basic functionality is done but wont work on windows due to use of fifo