More code refactoring to remove useless stuff