Major refactor; add more deferreds.