Adjust structure, convert to class and implement char read loop