refactored battleships