refactored dealing and hitting to use database