This isn't very DRY. Why the same code in two places? Refactor?