Move event polygon behavior to functions