Added JavaScript handling