A ton of refactoring/changes/additions