refactored cornbot