Removing some unused code and restructuring to be a bit cleaner