Removed the duping issue with the separator

Also fixed the buffering of the input