Add functions for other refactors.

Still need proper exception handling.
Also really need to improve selecting text in a reasonble way.