Refactor input module to use RStream class