Rewrite basically complete. Just need to copy over all the functionality from the other file