Refactored cornbot