Refactoring a 300-line if | Hacker News Reader