Added a Deferred to get around issue with functions firing out of order, thanks Michael!