REFACTOR Moved patch code into it's own class