One of the most challenging problems we face in our understanding of planet formation is how Jupiter and Saturn could have formed before the solar nebula dispersed. The most popular model of giant planet formation is the so-called core accretion model. In this model a large planetary embryo formed first, mainly by two-body accretion. This is then followed by a period of inflow of nebular gas directly onto the growing planet. The core accretion model has an Achilles heel, namely the very first step. We have undertaken the most comprehensive study of this process to date. In this study, we numerically integrate the orbits of a number of planetary embryos embedded in a swarm of planetesimals. In these experiments, we have included a large number of physical processes that might enhance accretion. In particular, we have included (1) aerodynamic gas drag, (2) collisional damping between planetesimals, (3) enhanced embryo cross sections due to their atmospheres, (4) planetesimal fragmentation, and (5) planetesimaldriven migration. We find that the gravitational interaction between the embryos and the planetesimals leads to the wholesale redistribution of material-regions are cleared of material and gaps open near the embryos. Indeed, in 90% of our simulations without fragmentation, the region near those embryos is cleared of planetesimals before much growth can occur. Thus, the widely used assumption that the surface density distribution of planetesimals is smooth can lead to misleading results. In the remaining 10% of our simulations, the embryos undergo a burst of outward migration that significantly increases growth. On timescales of ∼10 5 years, the outer embryo can migrate ∼6 AU and grow to roughly 30 M ⊕ . This represents a largely unexplored mode of core formation. We also find that the inclusion of planetesimal fragmentation tends to inhibit growth except for a narrow range of fragment migration rates.