renamed clock and refactored ai