Implemented second stage

Pretty much a rewrite. Still awkward from a UX standpoint, but it works.