refactored a tiny bit of dodo code