Refactored to use stdin and chars for service