JS fixes, general cleaning