Refactored Read() to introduce states to separate methods to improve readability.