Was looking into implementing a feature on top of this code, figured I better address the underlying parts first.