Refactored slightly for win.