Refactored a few places, need to come back and reimplement a few things...