Run functions correctly and fixed various JS bugs
Cleaned up generated HTML on run and fixed run bug on IDE buttons