It took me some playing around with this for quite a while to get the hang of it. When I figured it out I got really good results. After you apply the masks you need to manually fix the edges by using the erase brush with the image magnified to the maximum. Then you can switch between the foreground and background to the get the edge right down to the pixel.