refactor
use sysread