Progress on better JS structure