files copied from simvent.js