Modified to read user console input (stdin)