Add logic for hopper saving and refactoring, small code shifting