Refactor out GetNextSelection; add command replace_next

#454 
Oh yes. Sorry I'm new to Go, this whole 'save the pointer if it escapes the local scope' is a beautiful concept, but very new to me :). I'll make the change!