moved while loops in SysRead into function, don't know what to return