Infrastructure for a cleaner and faster sim in javascript