better code
deduped code