more js improvements and overall tweaks to the code