fixed bug in main.js line 20 nextUpdate
fixed bug in calcHEight and oraganized the code