refactored plan b