private static int doEvents( int firedEvents, long startTime )
    {

        Iterator< Event > it = events.iterator(); // get the iterator for the untimed events

        while ( it.hasNext() )
        {
            if ( TimeHelper.isOver( startTime, MaxTickTime ) )
            {
                return firedEvents; // we've run out of time for this tick, let's keep the game running
            }
            Event e = it.next(); // get the next event

            // we've reached the max number of events we can fire for now
            if ( firedEvents >= MaxEvents )
            {
                break;
            }

            try
            {
                e.action.invoke( e.target, e.parameters ); // invoke the method
                firedEvents++;
            }
            catch ( Exception ex )
            {
                Lumberjack.error( "Scheduler", "Failed to invoke \"%s.%s()\"", e.target.getClass().getSimpleName(), e.action.getName() );
                Lumberjack.throwable( "Scheduler", ex );
            }

            if ( LogOutput )
            {
                Lumberjack.debug( "Scheduler", "Executed event \"%s\"", e.action.getName() );
            }

            it.remove(); // remove the iterated object
        }

        return firedEvents;
    }