minor Javascript changes

* calling functions now instantly executes them and now longer adds them to a queue
* fixed some bugs